package com.hushan.elevator.utils;

import lombok.Data;

/*
 * 数据响应对象
 * */
@Data
public class Result {
    private boolean success;
    private Integer code;
    private String message;
    private Object data;
    private Object data2;

    public Result(ResultCode code){
        this.success = code.success;
        this.code = code.code;
        this.message = code.message;
    }
    public Result(ResultCode code,Object data){
        this.success = code.success;
        this.code = code.code;
        this.message = code.message;
        this.data = data;
    }
    public Result(ResultCode code,Object data,Object data2){
        this.success = code.success;
        this.code = code.code;
        this.message = code.message;
        this.data = data;
        this.data2 = data2;
    }
    public Result(boolean success,Integer code,String message){
        this.success = success;
        this.code = code;
        this.message = message;
    }
    public static Result SUCCESS(){
        return new Result(ResultCode.SUCCESS);
    }
    public static Result FAIL(){
        return new Result(ResultCode.FAIL);
    }
    public static Result ERROR(){
        return new Result(ResultCode.SERVER_ERROR);
    }
    public static Result UN_LOGIN(){
        return new Result(ResultCode.UN_LOGIN);
    }
    public static Result UN_AUTHORISE(){
        return new Result(ResultCode.UN_AUTHORISE);
    }
}